Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8 upgrade #74

Merged
merged 18 commits into from
Dec 27, 2022
Merged

PHP 8 upgrade #74

merged 18 commits into from
Dec 27, 2022

Conversation

flashadvocate
Copy link
Collaborator

Seems to function fine in PHP 7.4 all the way up to PHP 8.2. Of course 74 is now EOL so folks should move at least to 8.0. This PR fixes a few things that become fatal errors in PHP 8, as well as a few other minor housekeeping changes.

Also adds a docker environment including the two PHP extension dependencies (php-gp, and mysqli) as well as PHP 8.0. The mysql init script handles the mmftc database population, but stops short of injecting the DBC.

@flashadvocate flashadvocate changed the title Php8 upgrade PHP 8 upgrade Dec 24, 2022
@flashadvocate flashadvocate marked this pull request as ready for review December 24, 2022 02:40
@flashadvocate
Copy link
Collaborator Author

@Aokromes I believe this is good to go.

@@ -24,7 +24,7 @@ function connect($db_host, $db_username, $db_password, $db_name = NULL, $use_nam

if ($this->link_id){
if (!empty($use_names)) $this->query("SET NAMES '$use_names'");
} else die($lang_global['err_sql_conn_db']);
} else die($lang_global['err_sql_conn_db'] . " DB: {$db_name}");
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this to make it more clear which database is failing, since the default error language does not make it obvious, and there's several potential culprits

@@ -192,6 +192,7 @@ function top100($realmid, &$sqlr, &$sqlc)
<td>'.char_get_level_color($char['level']).'</td>';
if ($type === 'level')
{
// @TODO - fix N+ issue - query inside while loop
$guild_name = $sqlc->result($sqlc->query('SELECT BINARY name AS name FROM guild WHERE guildid = '.$char['gname'].''), 0);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

N+1 query issue here, probably shouldn't be inside the loop. Need to eager load this information elsewhere.

@Aokromes Aokromes merged commit cea2297 into TrinityCore:master Dec 27, 2022
@flashadvocate flashadvocate deleted the php8_upgrade branch December 27, 2022 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants